import cFetch from '../tools/utils/cFetch';
import HomeIndex from '../src/containers/HomeIndex'; 
import Tmenus from '../src/containers/Tmenus';
import Tlists from '../src/containers/Tlists';

import '../styles.styl';

const HomePage = (props) => {
	return (
		<div>
			<HomeIndex>
				<nav className="mar-top__global">
							<Tmenus></Tmenus>
						</nav>
						<main className="layouts-main">
							<Tlists lists={props.lists}></Tlists>
						</main>
			</HomeIndex>
		</div>
	)
}

HomePage.getInitialProps = async function() {
	// 默认获取marvel类的数据`https://api.tvmaze.com/search/shows?q=Marvel`
	const res = await cFetch('search/shows', {params: { q: 'Marval' }})
	const data = await res.json();
	return {
		lists: data
	}
}

export default HomePage